<?php
allowCors();
if (!methodsRequired(['get'])) return;
if (!checkAdmin($msg)) return;

if (isset($_REQUEST['gp_id'])) {
    $group = new Group();
    $group->setGpId($_REQUEST['gp_id']);
    $newData = [];
    if (isset($_REQUEST['gp_name']))
        $newData['gp_name'] = $_REQUEST['gp_name'];
    if (isset($_REQUEST['grouper_id']))
        $newData['grouper_id'] = $_REQUEST['grouper_id'];
    if ($db->edit($group,$newData)) {
        $msg->setCode(0);
    } else {
        $msg->setCode(3);
    }
} else {
    $msg->setCode(3);
}
echo $msg;